import 'package:flutter/material.dart';
import 'package:flutter_demo/common/ProfileChangeNotifier.dart';

import 'Global.dart';

class ThemeModel extends ProfileChangeNotifier {

  // 当没有主题的时候，默认选择蓝色的主题
  ColorSwatch get theme {
    return Global.theme.firstWhere((e)=> e.value == profile.theme, orElse: ()=>Colors.blue);
  }

  set theme(ColorSwatch color) {
    if (color != theme) {
      profile.theme = color[500].value;
      notifyListeners();
    }
  }

}